<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>思途CMS{$coreVersion}</title>
    {template 'stourtravel/public/public_min_js'}
    {php echo Common::getCss('style.css,base.css,base2.css,comment.css,base_new.css'); }
    {php echo Common::getScript("jquery.validate.js,hdate/hdate.js"); }
    {php echo Common::getScript("uploadify/jquery.uploadify.min.js,choose.js,product_add.js,imageup.js"); }
    {php echo Common::getCss('uploadify.css','js/uploadify/'); }
    {Common::getCss('hdate.css','js/hdate')}
</head>
<body>

<table class="content-tab">
    <tr>
        <td width="119px" class="content-lt-td" valign="top">
            {template 'stourtravel/public/leftnav'}
            <!--右侧内容区-->
        </td>
        <td valign="top" class="content-rt-td">
            <form id="frm" name="frm">
                <div id="product_grid_panel" class="manage-nr">
                    <div class="cfg-header-bar">
                        <a href="javascript:;" class="fr btn btn-primary radius mt-6 mr-10"
                           onclick="window.location.reload()">刷新</a>
                    </div>
                    <div class="product-add-div">
                        <ul class="info-item-block">

                            <li class="list_dl">
                                <span class="item-hd">分销二维码log：</span>
                                <div class="item-bd">
                                    <a href="javascript:;" id="fx_logo_btn" class="btn btn-primary radius size-S mt-3">上传图片</a>
                                    <div id="fx_logo_pic" class="mt-10">
                                        {if !empty($info['fx_code_logo'])}
                                        <img class="up-img-area" src="{$info['fx_code_logo']}">
                                        <input type="hidden" name="fx_code_logo" value="{$info['fx_code_logo']}">
                                        {/if}
                                    </div>
                                </div>
                            </li>

                            <li class="list_dl">
                                <span class="item-hd">分销邀请背景图：</span>
                                <div class="item-bd">
                                    <a href="javascript:;" id="fx_background_btn"
                                       class="btn btn-primary radius size-S mt-3">上传图片</a>
                                    <div id="fx_background_pic" class="mt-10">
                                        {if !empty($info['fx_code_background'])}
                                        <img class="up-img-area" src="{$info['fx_code_background']}">
                                        <input type="hidden" name="fx_code_background"
                                               value="{$info['fx_code_background']}">
                                        {/if}
                                    </div>
                                </div>
                            </li>
                        </ul>
                    </div>
                    <div class="clear clearfix mt-20">
                        <a class="btn btn-primary radius size-L ml-115" id="btn_save" href="javascript:;">保存</a>
                    </div>
                </div>
            </form>
        </td>
    </tr>
</table>

<script language="JavaScript">

    $(function () {

        //保存
        $("#btn_save").click(function () {
            $.ajaxform({
                url: SITEURL + "fenxiao/admin/config/ajax_configuration",
                method: "POST",
                isUpload: true,
                form: "#frm",
                dataType: "JSON",
                success: function (data, opts) {
                    if (data.status) {
                        ST.Util.showMsg('保存成功!', '4', 2000);
                    } else {
                        ST.Util.showMsg(data.msg, '5', 2000);
                    }
                }
            });
        });

        //上传分销邀请背景图
        $('#fx_background_btn').click(function () {
            ST.Util.showBox('上传图片', SITEURL + 'image/insert_view', 0, 0, null, null, document, {
                loadWindow: window,
                loadCallback: Insert
            });

            function Insert(result, bool) {
                var len = result.data.length;
                for (var i = 0; i < len; i++) {
                    var temp = result.data[i].split('$$');
                    var html = "<img class='up-img-area' src='" + temp[0] + "' />";
                    html += "<input type='hidden' name='fx_code_background' value='" + temp[0] + "'/>"
                    $("#fx_background_pic").html(html);
                }
            }
        })

        //上传分销二维码logo
        $('#fx_logo_btn').click(function () {
            ST.Util.showBox('上传图片', SITEURL + 'image/insert_view', 0, 0, null, null, document, {
                loadWindow: window,
                loadCallback: Insert
            });

            function Insert(result, bool) {
                var len = result.data.length;
                for (var i = 0; i < len; i++) {
                    var temp = result.data[i].split('$$');
                    var html = "<img class='up-img-area' src='" + temp[0] + "' />";
                    html += "<input type='hidden' name='fx_code_logo' value='" + temp[0] + "'/>"
                    $("#fx_logo_pic").html(html);
                }
            }
        })

    });
</script>

</body>
</html>